<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <title>登录 - bigben - 后台管理系统</title>
    <link rel="stylesheet" type="text/css" href="/style/plugins/layui/css/register-login.css">
</head>
<body>
<div id="box"></div>
<div class="cent-box">
    <div class="cent-box-header">
        <h1 class="main-title">Bigben</h1>
        <h2 class="sub-title"> 后台管理系统</h2>
    </div>

    <div class="cont-main clearfix">
        <form class="login form" action="#(ctx)admin/tologin" method="post">
            <div class="group">
                <div class="group-ipt email">
                    <input type="text" name="username" id="email" class="ipt" placeholder="输入您的登录帐号" required>
                </div>
                <div class="group-ipt password">
                    <input type="password" name="password" id="password" class="ipt" placeholder="输入您的登录密码" required>
                </div>
            </div>
            <div class="button">
                <button type="submit" class="login-btn register-btn button" id="embed-submit">登录</button>
            </div>
        </form>
    </div>
</div>

<div class="footer">
    <p>© 2017 <a href="http://www.benhailong.com" target="_blank">Bigben personal blog </a></p>
</div>

<script type="text/javascript" src="/style/plugins/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src='/style/plugins/layui/particles.js'></script>
<script type="text/javascript" src='/style/plugins/layui/background.js'></script>
<script type="text/javascript" src="/style/plugins/layui/gt.js"></script>
<script type="text/javascript" src="/style/bigben/js/ben-cookie.js"></script>
<script>
    layui.use(['jquery', 'layer'], function () {
        layui.$('form').submit(function () {
            var self = layui.$(this);
            layui.$.post(self.attr("action"), self.serialize(), function (data) {
                if (data.code != '200') {
                    layui.layer.msg(data.msg, {offset: 70, shift: 0});
                    captchaObj.reset();
                    return false;
                }
                layui.layer.msg(data.msg, {offset: 70, shift: 0});
                setTimeout(function () {
                    // 存cookie
                    var name = data.admin.admin_name;
                    setCookie('adminname',name , 30);
                    window.location.href = data.url;
                }, 1000);
            });
            return false;
        });
    });
</script>
</body>
</html>